<?php
ob_start();
require_once 'index1.php';

if(isset($_REQUEST['attempt'])){
 if(isset($_SESSION["staff"])){
     unset($_SESSION["staff"]);
 }else if(isset ($_SESSION["admin"])){
     unset($_SESSION["admin"]);
 }
session_destroy(); //destroy the session
header("refresh:1; url=http://localhost:8080/"); //to redirect back to "index.php" after logging out
echo "logout successfuly";
}else{
    echo 'this page is not allowed';
    header("refresh:2; url=http://localhost:8080");
}
require_once 'index2.php';
ob_end_flush();
?>
